package com.lfy.kcat.content.rpc;

import com.lfy.kcat.content.biz.DramaHomeService;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.dto.PageReqDTO;
import org.dromara.common.core.dto.home.HomeDramaEpisodesDTO;
import org.dromara.common.core.dto.home.HomeDramaInfoDTO;
import org.dromara.common.core.dto.home.HomeFeaturedDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author leifengyang
 * @version 1.0
 * @date 2025/9/17 10:56
 * @description:
 */
@Slf4j
@RestController
public class AppHomeDataController {

    @Autowired
    DramaHomeService dramaHomeService;

    @PostMapping("/home/featured/infoflow")
    public R<HomeFeaturedDTO> feature(@RequestBody PageReqDTO pageReqVo) {
        //获取首页精选数据
        HomeFeaturedDTO dto = dramaHomeService.getHomeFeatureDrama(pageReqVo);
        log.info("准备获取首页精选视频数据：{}", pageReqVo);
        return R.ok(dto);
    }


    @GetMapping("/dramas/{dramaId}/episodes/all")
    public R<HomeDramaEpisodesDTO> dramaEpisodesInfo(@PathVariable("dramaId") Long dramaId) {
        log.info("准备获取短剧所有剧集数据：{}", dramaId);
        HomeDramaEpisodesDTO dto = dramaHomeService.getDramaEpisodesInfo(dramaId);
        return R.ok(dto);
    }

    @GetMapping("/dramas/{dramaId}/info")
    public R<HomeDramaInfoDTO> dramaInfo(@PathVariable("dramaId") Long dramaId) {
        log.info("准备获取短剧信息：{}", dramaId);
        HomeDramaInfoDTO dto =  dramaHomeService.getDramaInfo(dramaId);
        return R.ok(dto);
    }

}
